package es.uem.listaactividades;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;

import android.view.View;

public class EjemploGraficos extends Activity {
	
	 private Drawable miImagen;
	 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new EjemploView(this));
        
        Resources res = this.getResources();
        miImagen = res.getDrawable(R.drawable.mi_imagen);  miImagen.setBounds(30,30,100,100);

    }
 
    public class EjemploView extends View {
            public EjemploView (Context context) {
                super(context);
            }
        @Override
            protected void onDraw(Canvas canvas) {
        	/*
        	Paint pincel = new Paint();
        	pincel.setColor(Color.BLUE);
        	pincel.setStrokeWidth(8);
        	pincel.setStyle(Style.STROKE);
        	canvas.drawCircle(150, 150, 100, pincel);
        	// pincel.setColor(Color.argb(127,255,0,0));
        	// pincel.setColor(0x7FFF0000);

        	pincel.setColor(getResources().getColor(R.color.color_circulo));
        	canvas.drawCircle(150, 250, 100, pincel);
        	*/
        	
        	/*
        	
        	Path trazo = new Path();
        	//trazo.addCircle(150, 150, 100, Direction.CCW);
        
        	trazo.moveTo(50, 100);
        	trazo.cubicTo(60,70, 150,90, 200,110);
        	trazo.lineTo(300,200);
        	
        	canvas.drawColor(Color.WHITE);
        	Paint pincel = new Paint();
        	pincel.setColor(Color.BLUE);
        	pincel.setStrokeWidth(8);
        	pincel.setStyle(Style.STROKE);
        	canvas.drawPath(trazo, pincel);
        	pincel.setStrokeWidth(1);
        	pincel.setStyle(Style.FILL);
        	pincel.setTextSize(20);
        	pincel.setTypeface(Typeface.SANS_SERIF);
        	canvas.drawTextOnPath("Universidad Europea de Madrid", trazo, 10, 40, pincel);
        	*/
        	
        	miImagen.draw(canvas);

        	
        }
    }
}
